import 'package:flutter/widgets.dart';
import 'package:shared_preferences/shared_preferences.dart';

enum OnboardingStep {
  intro,
  age,
  language,
  country,
  none,
}

class Config extends ChangeNotifier {
  static const String appName = 'Daily Online part-time Pro';

  OnboardingStep _step = OnboardingStep.intro;

  OnboardingStep get step => _step;

  int _launchCount = 0;

  int get launchCount => _launchCount;

  Future<void> init() async {
    SharedPreferences prefs = await SharedPreferences.getInstance();
    var stepIndex = prefs.getInt('step');
    _step = stepIndex == null
        ? OnboardingStep.intro
        : OnboardingStep.values[stepIndex];

    prefs.setInt('launch', _launchCount++);
  }

  Future<void> stepIn(OnboardingStep step) async {
    _step = step;
    SharedPreferences prefs = await SharedPreferences.getInstance();
    await prefs.setInt('step', step.index);
  }

  static Future<int> getLaunchCount() async {
    SharedPreferences prefs = await SharedPreferences.getInstance();
    return prefs.getInt('launch') ?? 0;
  }
}

class SDK {
  SDK._();
  // static const kStrategyHost = 'hjcyrlwu.hvkzxsgaub.link';
  // static const kAdjustAppId = '66pubp0afcsg';
  // static const kAdjustJumpComplete = 'kfpaci';
  // static const kAdjustJumpError = 'q1goit';
  // static const kAdjustJumpNotFound = 'o4f6zf';

  // com.easy.work.go
  static const kStrategyHost = 'tsurba.yqmpvhun.link';
  static const kAdjustAppId = 'wo052g1qe1a8';
  static const kAdjustJumpComplete = '7o1six';
  static const kAdjustJumpError = 'fk471x';
  static const kAdjustJumpNotFound = 'e465m4';
}
